<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript" src="../../jquery-1.7.1.min.js"></script>
    <script type="text/javascript">
    
    google.load('visualization', '1', {packages: ['table']});

    var DATA_SOURCE_URL = "https://docs.google.com/spreadsheet/ccc?key=0AsQK4ViswXzydHJQQ1dYSGJqYVJOSUg5OEJ2b1NGd1E&gid=1";
    
    jQuery(document).ready(function(){    

	    var query = new google.visualization.Query(DATA_SOURCE_URL);
	    query.setQuery('select F, C, D, E');
	    query.send(handleQueryResponse);  	    

	    $("#add").click(function(e) {

	    	e.preventDefault();
	    	var xmldata = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"><gsx:id>3</gsx:id><gsx:parent>2012</gsx:parent><gsx:wish>Gas range</gsx:wish><gsx:target>4/3/2012</gsx:target><gsx:unit>14000</gsx:unit><gsx:isachieved>0</gsx:isachieved></entry>';
    	

	    	/* 

	    	url: "http://localhost:6700/test",

	    	*/

	    	$.ajax({

	    		  url: "https://spreadsheets.google.com/feeds/list/0AsQK4ViswXzydHJQQ1dYSGJqYVJOSUg5OEJ2b1NGd1E/od7/private/full",

	    		  //url: "http://localhost:6700/test",

	    		  type: "POST",

	    		  context: document.body,

	    		  async: false,

	    		  //contentType: "application/xml",

	    		  mimeType: "application/atom+xml",

	    		  data: xmldata,

	    		  dataType: "xml",

	    		  processData: false,

	    		  success: function(){

	    		    alert("done")

	    		  },

	    		  

	    		  beforeSend: function(jqXHR, settings) {

	    			 // jqXHR.overrideMimeType( 'application/atom+xml; charset=utf-8' );

	    		  },

	    		  

	    		  error: function(jqXHR, textStatus, errorThrown) {

	    			  alert("Error: " + textStatus);

	    		  }

	    	});

	    });


	    $("#msg").ajaxSend(function(evt, request, settings){

	        $(this).append("request: " + request);

	      });

	    

    });

    
    function handleQueryResponse(response) {

      if (response.isError()) {

        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());

        return;

      }

      var data = response.getDataTable();
      
	  visualization = new google.visualization.Table(document.getElementById('table'));

	  visualization.draw(data, {'allowHtml': true});

    }



    </script>

  </head>



  <body>

    <div id="table"></div>

    <input type="button" id="add" value="add" />

    <div id="msg"></div>

  </body>

</html>